Skip to main content
Duet can be deployed using Docker for easy setup and portability. The Docker image includes all necessary dependencies for pair programming sessions.

Dockerfile Overview

The Duet Dockerfile uses a multi-stage build:
  1. Build stage - Compiles the Go binary
  2. Run stage - Creates a minimal runtime environment with development tools

What’s Included

The Docker image includes:
  • Neovim - Text editor for collaborative coding
  • Node.js & npm - JavaScript runtime and package manager
  • OpenSSH - SSH server and key management
  • Go binary - Compiled Duet server

Quick Start

1

Build the Docker image

2

Run the container

3

Connect via SSH

Configuration

Environment Variables

The Docker container accepts configuration through command-line arguments:

Port Mapping

The Dockerfile exposes port 2222 by default:
Map it to a different host port:

Volume Mounts

Persist workspaces across container restarts:
Each room gets its own subdirectory under /app/workspaces.

Custom Worker URL

To use your own Cloudflare Worker:

Docker Compose

Create a docker-compose.yml file:
Run with:

Production Deployment

Fly.io

Duet includes a fly.toml configuration for deployment on Fly.io:
1

Install Fly CLI

2

Login to Fly.io

3

Deploy the application

4

Set secrets

If you need to configure the Worker URL via secrets:

Resource Configuration

The default Fly.io configuration uses:
  • Memory: 1GB
  • CPU: 1 shared CPU
  • Auto-scaling: Machines stop when idle, start on demand
  • Minimum running: 0 (cost-effective for low traffic)
The auto_stop_machines and auto_start_machines settings help reduce costs by stopping idle machines.

Security Considerations

SSH Host Keys

The Dockerfile generates SSH host keys at build time:
For production, consider mounting a persistent host key to avoid key changes on container restarts:

Non-Root User

The container runs as a non-root user duet for security:

Troubleshooting

Check Container Logs

Interactive Shell

Access the container:

Verify SSH Key

Check if the host key exists:

Common Issues

  • Connection refused: Verify port mapping is correct
  • Permission denied: Check SSH host key permissions
  • Worker not responding: Verify Worker URL is accessible from container